<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/layui-src@2.6.4/dist/css/layui.css">
    <script src="//cdn.jsdelivr.net/npm/layui-src@2.6.4/dist/layui.js"></script>
</head>
<body>
<form class="layui-form" action="" method="post">
    <textarea  th:text="${sysReportbyId.id}" name="id" style="display: none"></textarea>
<!--    <textarea  th:text="${#dates.format(sysReportbyId.createTime,'yyyy-MM-dd HH:mm:ss')}" name="createTime" ></textarea>-->
    <textarea  th:text="${sysReportbyId.userId}" name="userId" style="display: none"></textarea>
    <textarea  th:text="${sysReportbyId.remark}" name="remark" style="display: none"></textarea>
    <div class="layui-form-item">
        <label class="layui-form-label">个人体温情况</label>
        <div class="layui-input-block">
            <input type="radio" name="temperature"  th:attr="checked=${a.dictKey == sysReportbyId.temperature?true:false}" th:each="a:${dict['temperature']}" th:title="${a.dictValue}" th:value="${a.dictKey}"></input>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否有下列情况？（可多选）</label>
        <div class="layui-input-block">
<!--            <input type="checkbox" name="physical_condition" th:attr="checked=${#strings.contains(sysReportbyId.physicalCondition,c.dictKey)?true:false}" th:each="physicalCondition:${dict['physicalCondition']}" th:title="${physicalCondition.dictValue}" th:value="${physicalCondition.dictKey}" ><br/></input>-->
            <input type="checkbox" name="physical_condition" th:attr="checked=${#strings.contains(sysReportbyId.physicalCondition,c.dictKey)?true:false}" th:each="c:${dict['physical_condition']}" th:title="${c.dictValue}" th:value="${c.dictKey}" ></input>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">近期动向</label>
        <div class="layui-input-block">
            <input type="radio" name="travel" th:checked="${#strings.contains(sysReportbyId.travel,travel.dictKey)}" th:each="travel:${dict['travel']}" th:value="${travel.dictKey}" th:title="${travel.dictValue}"><br/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">近期行程描述</label>
        <div class="layui-input-block">
            <textarea th:text="${sysReportbyId.travelDescription}" name="travelDescription" placeholder="请输入出行描述" class="layui-textarea"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">修改</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
<script>
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            $ = layui.jquery;
            var arr_box = [];
            $('input[type=checkbox]:checked').each(function() {
                arr_box.push($(this).val());
            });
            //数组
            data.field["physicalCondition"] = arr_box.join(",")
            // ajax 传输数据
            $.ajax({
                url:"/report/update",
                type:'POST',
                contentType: "application/json",
                data:JSON.stringify(data.field),
                dataType:'json',
                success:function(result){
                    layer.alert("修改成功", {icon: 6},function (index1) {
                        window.parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);

                    });
                }
            });
            return false;
        });
    });
</script>
</html>